package com.df.gameserver.common;


import com.df.gameserver.net.websocket.WebSocketServer;
import com.df.gameserver.scriptmanager.CommonScriptManager;
import com.df.gameserver.scriptmanager.MsgScriptManager;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@RequiredArgsConstructor
@Component
public class CommandLineEntry implements CommandLineRunner {

    private final WebSocketServer webSocketServer;

    @Override
    public void run(String... args) throws Exception {
        //加载所有消息处理脚本
        MsgScriptManager.getInstance();
        //加载所有功能的通用处理脚本
        CommonScriptManager.getInstance();
        webSocketServer.setDaemon(false);
        webSocketServer.start();
    }
}
